import org.omg.CORBA.PUBLIC_MEMBER;
import sun.management.snmp.jvmmib.JVM_MANAGEMENT_MIBOidTable;

import java.util.jar.JarOutputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-08-15
 * Time: 20:38
 */
public class Test1 {
   static int cnt=6;
   static {
       cnt+=9;
   }

    public static void main(String[] args) {
        System.out.println(cnt);
    }
    static {
       cnt/=3;
    }
}


class Test2{
    public String toString(){
        System.out.print("aaa");
        return "bbb";
    }

    public static void main(String[] args) {
        Test2 test2=new Test2();
        System.out.println(test2);
    }
}


class Base11{
    Base11(){
        System.out.print("Base");
    }
}
 class Alpha extends Base11{
    public static void main(String[] args) {
        new Alpha();
        new Base11();
    }
}

class Base1{
    public Base1(String s){
        System.out.print("B");
    }
}
class Derived extends Base1{
    public Derived(String s){
        super(s);
        System.out.print("D");
    }

    public static void main(String[] args) {
        new Derived("C");
    }
}



class X{
    Y y=new Y();
    public X(){
        System.out.print("x");
    }
}
class Y{
    public Y(){
        System.out.print("Y");
    }
}
class Z extends X{
    Y y=new Y();
    public Z(){
        System.out.print("z");
    }

    public static void main(String[] args) {
        new Z();
    }
}









class Animal{
    public String name;
    private int age;

    public Animal(String name,int age){
        this.name=name;
        this.age=age;
    }
    public void eat(){
        System.out.println(this.name+"吃饭");
    }

}

class Dog extends Animal{
    public Dog(String name,int age)
    {
        super(name,age);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"吃骨头");
    }
}

class TestAnimal{
    public static void eatFood(Animal animal)
    {
        animal.eat();
    }
    public static Animal Testf(){
        return new Dog("sdf",56);
    }
    public static void main(String[] args) {

        Dog dog=new Dog("xiaowang",11);
        //dog.eat();

        Animal animal=new Dog("wanger",23);//直接赋值

        eatFood(dog);//传参

        Animal animal1=Testf();//函数返回值
        animal.eat();
    }
}


